package com.dianban.controller;

import com.dianban.base.ResultVo;
import com.dianban.service.ShoproOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@Api(value = "ApiSyncShoproOrderController", description = "同步商户订单控制器")
@RestController
@RequestMapping(value = "${interfacePath}/syncShoproOrder/")
public class ApiSyncShoproOrderController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(ApiSyncShoproOrderController.class);

    @Autowired
    private ShoproOrderService shoproOrderService;

    @ApiOperation(notes = "syncOrder", httpMethod = "GET", value = "同步订单数据处理线下核销状态相关值")
    @RequestMapping(value = "syncOrder", method = RequestMethod.GET)
    public ResultVo syncOrder(HttpServletRequest request, HttpServletResponse response) {
        logger.info("同步订单数据处理线下核销状态相关值,开始");
        try {
            shoproOrderService.syncOrder();
        } catch (Throwable e) {
            logger.error("同步订单数据处理线下核销状态相关值,异常:{}", e.getMessage());
            e.printStackTrace();
        }
        logger.info("同步订单数据处理线下核销状态相关值,完成");
        return ResultVo.success("", "操作成功");
    }

}
